package communication.common.business.chat;

import communication.common.business.base.CommonBaseHandler;
import communication.common.business.base.FcrSocketAddress;
import communication.common.business.base.MethodMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 处理网络
 * @author mac
 */
@Slf4j
@Component
public class DefaultChatModuleHandler extends CommonBaseHandler {

    @Autowired
    private ChatService chatService;

    @PostConstruct
    private void init() throws Exception {
        // 处理聊天信息
        MethodMap chat=MethodMap.builder()
                .op("msg")
                .serviceBean(chatService)
                .methodName("handleChatMsg")
                .type(0)
                .requestClassList(new Class[]{String.class, FcrSocketAddress.class})
                .responseClass(null)
                .build();

        addMethodMap(chat);
    }


    @Override
    public String getModuleName() {
        return "chat";
    }
}
